package com.bestcem.xm.member.mq;//package com.bestcem.xm.member.mq;
//
//import com.bestcem.xm.config.RabbitMqConstantConfig;
//import com.bestcem.xm.member.config.SendMemberConfig;
//import org.springframework.amqp.core.Binding;
//import org.springframework.amqp.core.BindingBuilder;
//import org.springframework.amqp.core.DirectExchange;
//import org.springframework.amqp.core.Queue;
//import org.springframework.amqp.rabbit.config.SimpleRabbitListenerContainerFactory;
//import org.springframework.amqp.rabbit.connection.ConnectionFactory;
//import org.springframework.amqp.rabbit.listener.RabbitListenerContainerFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//
//@Configuration
//public class MemberSliceRabbitConfig {
//    /**
//     * 推送联系人配置
//     */
//    @Autowired
//    private SendMemberConfig sendMemberConfig;
//
//    @Autowired
//    private RabbitMqConstantConfig rabbitMqConstantConfig;
//
//    @Bean("memberSliceQueue")
//    public Queue memberSliceQueue() {
//        return new Queue(rabbitMqConstantConfig.getAppBpMemberMemberSliceQueue(), true,
//                false, false);
//    }
//
//    @Bean("memberSliceExchange")
//    public DirectExchange memberSliceExchange() {
//        return new DirectExchange(rabbitMqConstantConfig.getAppBpMemberMemberSliceExchange(), true,
//                false);
//    }
//
//    @Bean("memberSliceBinding")
//    public Binding memberSliceBinding() {
//        return BindingBuilder.bind(memberSliceQueue()).to(memberSliceExchange())
//                .with(rabbitMqConstantConfig.getAppBpMemberMemberSliceRoutingKey());
//    }
//
//    @Bean("memberSliceContainerFactory")
//    public RabbitListenerContainerFactory<?> memberSliceContainerFactory(ConnectionFactory connectionFactory) {
//        //SimpleRabbitListenerContainerFactory发现消息中有content_type有text就会默认将其转换成string类型的
//        SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory();
//        factory.setPrefetchCount(sendMemberConfig.getReceiverPrefetchCount());
//        factory.setConnectionFactory(connectionFactory);
//        return factory;
//    }
//}
